package com.smh.a06regexDemo6;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {
    public static void main(String[] args) {

        String s = "JaVa8,,JAva11,JavA17,JAVA8,Java";

        //java后面拼接8,11,17三个任意一个
        //但是只获取前面的(忽略大小写)
        String regex = "((?i)Java)(?=8|11|17)";
        //获取整体
        String regex2 = "((?i)Java)(8|11|17)";
        String regex3 = "((?i)Java)(?:8|11|17)";
        //不要带8/11/17的
        String regex4 = "((?i)Java)(?!8|11|17)";
        Pattern p = Pattern.compile(regex4);
        Matcher m = p.matcher(s);
        while (m.find()){
            System.out.println(m.group());
        }
    }
}
